<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <script type="text/javascript" src="../build/jsMotif.js"></script>
        
        <title>jsMotif example appending to container</title>
    </head>
    <body>

        <div id="placeHolder"></div>
        
		<script id="template" type="text/template">
            <div>
                <div>
                    <label>Name:</label>
                    <span fill="{name}"></span><br>
                    <label>Surname:</label>
                    <span fill="{surname}"></span>
                </div>
                <p>
                    <label>Address</label><br>
                    <span fill="{address.houseNumber}"></span> 
                    <span fill="{address.street}"></span><br>
                    <span fill="{address.city}"></span> 
                    <span fill="{address.country}"></span>
                </p>
            </div>
        </script>

        <script type="text/javascript">
            var person = {
                name: 'Jon',
                surname: 'Doe',
                age: 30,
                address: {
                    city: 'London',
                    street: 'New Street',
                    houseNumber: 10,
                    country: 'England' 
                }
            }
            
            var tpl = new jsMotif.Template({
                    template: 'template'
                });
            
			/**
				Passing 3rd param in addition to targetNode when calling render function
				will cause the template to be appended (normally it would clean the target before rendering
				into it)
			*/
            tpl.render(person, 'placeHolder', true);
            tpl.render(person, 'placeHolder', true);
            tpl.render(person, 'placeHolder', true);   
                
                
        </script>
        
    </body>
</html>
